package com.lavegue.webaction;

import java.io.FileInputStream;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.struts2.ServletActionContext;

import com.lavegue.common.BaseAction;
import com.lavegue.common.Constants;
import com.lavegue.common.ListAction;
import com.lavegue.common.Page;
import com.lavegue.model.Area;
import com.lavegue.model.Beadroll;
import com.lavegue.model.Company;
import com.lavegue.model.UserInfo;
import com.lavegue.service.AreaService;
import com.lavegue.service.BeadrollService;
import com.lavegue.util.StringUtil;

/**
 * LJP 20120229
 * 后台数据管理模块
 * @author LJP
 *
 */
public class DataManageAction  extends ListAction<Beadroll>{
	private BeadrollService beadrollService;
	private AreaService areaService;
	private String xlsFile;    //文件路径
	private String excelPostfixName; //Excel文件的后缀名
	private String actionError=""; // 界面显示的错误信息
	private Page<Beadroll> beadrollPage;
	private Beadroll beadroll;
	private int returnFlag;
	// 省列表
	private List<Area> provinces;
	// 城市列表
	private List<Area> cityList;
	// 区域列表
	private List<Area> areaList;
	// 省份ID
	private Integer sf_id;
	// 城市ID
	private Integer cs_id;
	// 区域ID
	private Integer qy_id;
	private String sfName;
	private String csName;
	private String quName;
	
	private int [] beadrollBox; //复选框的值(dataListSearch.jsp)
	
	public Page getBeadrollPage() {
		return beadrollPage;
	}

	public void setBeadrollPage(Page beadrollPage) {
		this.beadrollPage = beadrollPage;
	}

	public int[] getBeadrollBox() {
		return beadrollBox;
	}

	public void setBeadrollBox(int[] beadrollBox) {
		this.beadrollBox = beadrollBox;
	}

	public int getReturnFlag() {
		return returnFlag;
	}

	public void setReturnFlag(int returnFlag) {
		this.returnFlag = returnFlag;
	}

	public Beadroll getBeadroll() {
		return beadroll;
	}

	public void setBeadroll(Beadroll beadroll) {
		this.beadroll = beadroll;
	}

	public String getXlsFile() {
		return xlsFile;
	}

	public void setXlsFile(String xlsFile) {
		this.xlsFile = xlsFile;
	}

	public String getExcelPostfixName() {
		return excelPostfixName;
	}

	public void setExcelPostfixName(String excelPostfixName) {
		this.excelPostfixName = excelPostfixName;
	}

	public String getActionError() {
		return actionError;
	}

	public void setActionError(String actionError) {
		this.actionError = actionError;
	}

	public AreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}

	public List<Area> getProvinces() {
		return provinces;
	}

	public void setProvinces(List<Area> provinces) {
		this.provinces = provinces;
	}

	public List<Area> getCityList() {
		return cityList;
	}

	public void setCityList(List<Area> cityList) {
		this.cityList = cityList;
	}

	public List<Area> getAreaList() {
		return areaList;
	}

	public void setAreaList(List<Area> areaList) {
		this.areaList = areaList;
	}

	public String getSfName() {
		return sfName;
	}

	public void setSfName(String sfName) {
		this.sfName = sfName;
	}

	public String getCsName() {
		return csName;
	}

	public void setCsName(String csName) {
		this.csName = csName;
	}

	public String getQuName() {
		return quName;
	}

	public void setQuName(String quName) {
		this.quName = quName;
	}

	public Integer getSf_id() {
		return sf_id;
	}

	public void setSf_id(Integer sfId) {
		sf_id = sfId;
	}

	public Integer getCs_id() {
		return cs_id;
	}

	public void setCs_id(Integer csId) {
		cs_id = csId;
	}

	public Integer getQy_id() {
		return qy_id;
	}

	public void setQy_id(Integer qyId) {
		qy_id = qyId;
	}

	public BeadrollService getBeadrollService() {
		return beadrollService;
	}

	public void setBeadrollService(BeadrollService beadrollService) {
		this.beadrollService = beadrollService;
	}
	
	/**20120229
	 * 进入添加名录数据页面(addNewData.jsp)
	 * @return
	 */
	public String toAddDataPage(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		// 获取省列表,在页面显示省份
		provinces = areaService.findAreaByParendIdAndlvType(Area.NO_PARENT,
				Area.AreaType.PROVINCE);
		
		return "enterAddDataPage";
	}
	
	/**20120229
	 * 添加名录数据功能(addNewData.jsp)
	 * @return
	 */
	public String doAddBeadrollData(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		try {
			beadrollService.insertBeadroll(beadroll); //添加名录新数据
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return toDataListPage();
	}
	
	/**20120229
	 * 进入批量导入数据页面(batchImportBeadrollData.jsp)
	 * @return
	 */
	public String toBatchImportDataPage(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		return "enterBatchImportPage";
	}
	
	/**20120306
	 * 批量导入名录的数据功能
	 * @return
	 */
	public String doBatchImportBeadrollData(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		// 构造 XSSFWorkbook 对象，xlsFile 传入文件路径
		Workbook xwb = null;
		try {
			if(excelPostfixName.equals("xls")){
				xwb = new HSSFWorkbook(new FileInputStream(xlsFile)); //读取2003Excel.xls文件
			}else{
				xwb = new XSSFWorkbook("D:/aa.xls"); //读取2007Excel.xlsx文件
			}
		} catch (Exception e) {
			e.printStackTrace();
//			try {
//				xwb = new HSSFWorkbook(new FileInputStream(xlsFile)); //读取2003Excel.xls文件
//			} catch (Exception e1) {
//				// TODO Auto-generated catch block
//				e1.printStackTrace();
//			}  
		}
		try {
			// 读取第一章表格内容    
			Sheet sheet = xwb.getSheetAt(0);    
			// 定义 row、cell    
			Row row;    
			String cell="";
			List<Map<Integer, String>> beadrollList = new ArrayList();
			// 循环输出表格中的内容    
			for (int i = sheet.getFirstRowNum()+1; i < sheet.getPhysicalNumberOfRows(); i++) { //获取行数据    
			    row = sheet.getRow(i);
			    Map<Integer, String> map = new HashMap();
			    boolean flag =false;
			    int colCnt = sheet.getRow(0).getPhysicalNumberOfCells(); //获取第一行头的标题有多少列
			   // System.out.println("Row行数：="+sheet.getPhysicalNumberOfRows());
			   // System.out.println("Cell列数：="+colCnt);
			    //如果某一行的第一列和第二列为空，就认为这行没有记录
			    if (((row.getCell(0) ==null || StringUtil.isEmpty(row.getCell(0).toString()))  && (row.getCell(1) ==null || StringUtil.isEmpty(row.getCell(1).toString())))) {
			    	continue;
			    }
			    
			    for (int j = row.getFirstCellNum(); j < colCnt; j++) { //获取列数据
			        // 通过 row.getCell(j).toString() 获取单元格内容，
			    	if (row.getCell(j) == null) {
			    		map.put(j, "");
			    	//	System.out.println("null...");
			    	}else{
			    		if ((j == 4 || j == 5 || j == 6) && (row.getCell(j).getCellType() ==0)) {
			    			DecimalFormat dFormat = new DecimalFormat("####");
			    			cell = dFormat.format(Double.parseDouble(row.getCell(j).toString()));
			    				//row.getCell(j).toString();
			    		//	System.out.println("第"+i+"行,第"+j+" 列的类型："+row.getCell(j).getCellType());
			    		} else {
			    			cell = row.getCell(j).toString();
			    		}
			    		
					     System.out.println("第"+i+"行,第"+j+"列的值="+cell);
					     map.put(j, cell);
			    	}
			       
			       // System.out.print(cell + "/t");    
			    }
			    if (!(StringUtil.isEmpty(map.get(0))  && StringUtil.isEmpty(map.get(1)))) {
			    	beadrollList.add(map);//获取一行所有的列的数据放到list里
			    }
			}

			List<Beadroll> beadrollListTran = transfer(beadrollList);
			if(null != beadrollListTran && beadrollListTran.size()>0){
				 
				for(Beadroll beadroll: beadrollListTran){			
					beadrollService.insertBeadroll(beadroll); //添加名录数据
				}
				actionError = "名录数据已导入.";
			}else{
				actionError = "Excel文件的名录数据不合格.";
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}    
		
		return "enterBatchImportPage";
	}
	
	/**
	 * 该方法用来转换Map存放Beadroll记录里面数据
	 * @param list
	 * @return
	 */
	private List<Beadroll> transfer(List<Map<Integer, String>> list) {
		List<Beadroll> ulist= new ArrayList<Beadroll>();
		List<Map<Integer, String>> listCompare = new ArrayList<Map<Integer,String>>();
		if(null != list){
			listCompare = list;
		}
		for (int i = 0; i < list.size(); i++) {
			Beadroll beadroll = new Beadroll();
			StringBuffer sbu = new StringBuffer();
			
			Map map = (Map)list.get(i); //获取第一条记录的数据
			
			if(null != map.get(0) && !map.get(0).equals("")){//获取公司名称
				String companyName = map.get(0).toString(); 
				beadroll.setCompany(companyName);
			}else{
				sbu.append("公司名称不能为空 ;");
			}
					
			if(null != map.get(1) && !map.get(1).equals("")){ //联系人
				String linkman = map.get(1).toString();
				beadroll.setLinkman(linkman);
			}else{
				sbu.append("联系人不能为空;");
			}
			
			if(null != map.get(2) && !map.get(2).equals("")){//职位
				String position = map.get(2).toString(); 
				beadroll.setPosition(position);
			}else{
				sbu.append("职位不能为空;");
			}
			
			
			if(null != map.get(3) && !map.get(3).equals("")){//法定代表人
				String juridicalPerson = map.get(3).toString(); 
				beadroll.setJuridicalPerson(juridicalPerson);
			}else{
				sbu.append("法定代表人不能为空;");
			}
			
			if(null != map.get(4) && !map.get(4).equals("")){ // 电  话
				String keyVal4 = map.get(4).toString().trim(); 
				//0755-12345678(13) 075512345678(12) | 021-12345678(12) 02112345678(11) |
				// 755-1234567(11) | 12345678(8)| 0736-1234567(12) 
//				if(keyVal4.length()==13 || keyVal4.length()==12 || keyVal4.length()==11 || keyVal4.length()==8 || keyVal4.length()==7){
//					String replaceTel = keyVal4.replaceAll(" ", ""); //替换空格
//					if(StringUtil.isTelPhone(replaceTel)){
						beadroll.setTel(keyVal4);
/*					}else{
						sbu.append("电话号码格式有误;");
					}
				}else if (keyVal4.length() > 13) {//86075512345678(14) 860755-12345678(15) 
					String replace = keyVal4.replaceAll(" ", ""); //替换空格
					String subStr = replace.substring(0, 2);
					if(subStr.equals("86")){
						String subTel = replace.substring(2,replace.length());	
						if(StringUtil.isTelPhone(subTel)){
							beadroll.setTel(subTel);
						}else{
							sbu.append("电话号码格式有误;");
						}
					}else{ // 11 0755 12345678
						sbu.append("电话号码格式有误;");
					}
				}else {
					sbu.append("电话号码格式有误;");
				}*/
				
			}else{
				beadroll.setTel("");
			}
			
			if(null != map.get(5) && !map.get(5).equals("")){ //移动电话
				String mobile = map.get(5).toString().trim();
				if(StringUtil.isAccount(mobile)){ //判断是否是手机号码
					beadroll.setMobile(mobile);
				}else{
					sbu.append("输入的移动电话有误;");
				}
				
			}else{
				sbu.append("移动电话不能为空;");
			}
			
			if(null != map.get(6) && !map.get(6).equals("")){// 传  真
				String fax = map.get(6).toString().trim();
				String replaceFax = fax.replaceAll(" ", ""); //替换空格
//				if(StringUtil.isTelPhone(replaceFax)){
					beadroll.setFax(replaceFax);
//				}else{
//					sbu.append("输入的传真格式有误;");
//				}
				
			}else{
				beadroll.setFax("");
			}
			
			if(null != map.get(7) && !map.get(7).equals("")){//地址
				String address = map.get(7).toString(); 
				beadroll.setAddress(address);
			}else{
				beadroll.setAddress("");
			}
			
			if(null != map.get(8) && !map.get(8).equals("")){//年营业额
				String yearTurnover = map.get(8).toString(); 
				beadroll.setYearTurnover(yearTurnover);
			}else{
				beadroll.setYearTurnover("");
			}
			if(null != map.get(9) && !map.get(9).equals("")){//邮箱
				String email = map.get(9).toString().trim(); 
//				if(StringUtil.isEmail(email)){
					beadroll.setEmail(email);
//				}else{
//					sbu.append("输入的E_Mail电子邮箱格式有误;");
//				}
			}else{
				beadroll.setEmail("");
			}
			
			if(null != map.get(10) && !map.get(10).equals("")){//注册资本
				String regCapital = map.get(10).toString(); 
				beadroll.setRegCapital(regCapital);
			}else{
				beadroll.setRegCapital("");
			}
			
			if(null != map.get(11) && !map.get(11).equals("")){//公司介绍
				String intro = map.get(11).toString().trim(); 
//				if(intro.length() > 1000){
//					sbu.append("公司简介不能超过1000字符;");
//				}else{
					beadroll.setIntro(intro);
//				}
			}else {
				beadroll.setIntro("");
			}	
				
			if(null != map.get(12) && !map.get(12).equals("")){  //省份不为空时
				String keyVal12 = map.get(12).toString(); //所属省
				
				String shengfen = keyVal12; //省的名称
				// 查询省份的一条记录
				List<Area> sfList = areaService.findAreaByNameTypeid(Area.AreaType.PROVINCE,shengfen);
				if(null != sfList && sfList.size()>0){
						Area sf_area = sfList.get(0);
						sf_id = sf_area.getId();  // 得到省份ID<*>
						beadroll.setProvinceArea(sf_area);  //设置省份ID

					if(null != map.get(13) && !map.get(13).equals("")){  //城市不为空时
							String keyVal7 = map.get(13).toString(); //所属市
							
							String chengshi = keyVal7;  //城市的名称
							 // 查询城市的一条记录
							List<Area> csList = areaService.findAreaByName(sf_id, chengshi);
							if(null != csList && csList.size()>0){
									Area cs_area = csList.get(0);
									cs_id = cs_area.getId();  // 得到城市ID<*>
									beadroll.setCityArea(cs_area); //设置城市ID
							}else{
								sbu.append("输入的城市有误;");
							}
												
					 }else{
						sbu.append("城市不能为空;");
					 }
					
				}else{
					sbu.append("输入的省份有误;");
				}
				
			}else{
				sbu.append("省份不能为空;");
			}
			
			
			if(!sbu.toString().equals("")){
				this.addActionError("第"+(i+2)+"行："+sbu.toString()+" 导入失败!");
			}else{
				ulist.add(beadroll); //如果数据正确就添加到list里面
			}
			
		}
				
		return ulist;
	}
	
	/**20120229
	 * 进入数据列表查询页面(dataListSearch.jsp)
	 * @return
	 */
	public String toDataListPage(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		Integer provinceId = null;  //省份ID
		Integer cityId = null;      //城市ID
		// 获取省列表,在页面显示省份
		provinces = areaService.findAreaByParendIdAndlvType(Area.NO_PARENT,
				Area.AreaType.PROVINCE);
		if(null != beadroll && beadroll.getProvinceArea().getId().intValue()!=0){
			if(null != beadroll.getProvinceArea() && beadroll.getProvinceArea().getId().intValue() != 0){
				Area proArea = beadroll.getProvinceArea();
				provinceId = proArea.getId();
			}
			if(null != beadroll.getCityArea() && beadroll.getCityArea().getId().intValue() != 0){
				Area cityArea = beadroll.getCityArea();
				cityId = cityArea.getId();
				
			}
			// 通过省份ID查询所有城市，页面获取值<*>
			cityList = areaService.findAreaByParendIdAndlvType(provinceId,Area.AreaType.CITY);
		}else{
			cityList = new ArrayList<Area>();
		}
		
		//查询所有的名录记录
		beadrollPage = beadrollService.findAllBeadrollList(pageNo, pageSize2, provinceId, cityId);
			
		return "enterDataListPage";
	}
	
	/**20120229
	 * 进入名录[查看]详情 (beadrollRecordDetail.jsp)
	 * @return
	 */
	public String toBeadrollLookDetail(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		try {
			String beadrollid = ServletActionContext.getRequest().getParameter("bid");
			Integer bid = Integer.valueOf(beadrollid);
			
			beadroll = beadrollService.queryBeadroll(bid);
						
			//通过省份ID查询获取名称
//			 Area areaProvince = areaService.findById(beadroll.getProvince());
//			 	sfName = areaProvince.getName(); //获取省份名称
//			 if(null != beadroll.getCity() && !beadroll.getCity().equals("")){
//				 Area areaCity = areaService.findById(beadroll.getCity());
//				csName = areaCity.getName(); //获取城市名称
//			 }
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return "enterLookDetail";
	}
	
	/**20120229
	 * 进入[编辑]名录数据的页面 (editBeadroll.jsp)
	 * @return
	 */
	public String toEditBeadrollInfo(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		try {			
			String beadrollid = ServletActionContext.getRequest().getParameter("bid");
			if(null != beadrollid && !beadrollid.equals("")){
				Integer bid = Integer.valueOf(beadrollid);
				beadroll = beadrollService.queryBeadroll(bid);
				this.setRequestAtrribute("beadrollid",beadrollid);
			}else { //修改名录之后进入 else处理
				beadroll = beadrollService.queryBeadroll(beadroll.getId());
				this.setRequestAtrribute("beadrollid",beadroll.getId());
			}
			sf_id = beadroll.getProvinceArea().getId();  //省份ID
			if(null != beadroll.getCityArea()){
				cs_id = beadroll.getCityArea().getId();   //城市ID
			}
			// 获取省列表,在页面显示省份
			provinces = areaService.findAreaByParendIdAndlvType(Area.NO_PARENT,
					Area.AreaType.PROVINCE);
			
			// 通过省份ID查询所有城市，页面获取值<*>
			cityList = areaService.findAreaByParendIdAndlvType(sf_id,Area.AreaType.CITY);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return "enterEditBeadroll";
	}
	
	/**20120229
	 * 修改名录数据的功能
	 * @return
	 */
	public String doEditBeadroll(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		
		try {
			boolean flag = beadrollService.updateBeadroll(beadroll); //修改名录数据
			if(flag){
				actionError = "修改名录信息成功.";
			}else {
				actionError = "修改名录信息失败.";
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return toEditBeadrollInfo();
	}
	
	/**20120229
	 * [删除]名录记录
	 * @return
	 */
	public String doDelBeadrollRecord(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		try {
			String beadrollid = ServletActionContext.getRequest().getParameter("bid");
			Integer bid = Integer.valueOf(beadrollid);
			
			beadroll = beadrollService.queryBeadroll(bid);
			beadrollService.deleteBeadroll(beadroll); //删除记录
			//beadrollService.deleteById(bid);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return toDataListPage();
	}
	
	/**201200308
	 * 删除多条名录记录
	 */
	public String doDelAllBeadroll(){
		if(null == this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		{
			return "lg";
		}
		for (int beadrollTd : beadrollBox) { //beadrollBox是复选框的值(dataListSearch.jsp)
			beadroll = beadrollService.queryBeadroll(beadrollTd);
			if (null != beadroll) {
				beadrollService.deleteBeadroll(beadroll); //删除记录
			}
		}
		return toDataListPage();
	}
	
	/**20120305
	 * 前台-点击进入名录搜索( beadrollSearch\beadrollSearch.jsp )
	 * @return
	 */
	public String toBeadrollSearchPage(){
		if(null == this.getSessionAtrribute(Constants.SESSION_USER))
		{
			return "g_login";
		}
		
		return "enterBeadrollSearch";
	}
	/**20120305
	 * 前台-点击[进行搜索]按钮( beadrollSearch\beadrollListSearch.jsp )
	 * @return
	 */
	public String enterBeadrollSearchList(){
		if(null == this.getSessionAtrribute(Constants.SESSION_USER))
		{
			return "g_login";
		}
		
		return "beadrollSearchList";
	}
	/**20120305
	 * 前台-进行名录搜索功能 (beadrollSearch\beadrollListSearch.jsp)
	 * @return
	 */
	public String proceedBeadrollSearchList(){
		if(null == this.getSessionAtrribute(Constants.SESSION_USER))
		{
			return "g_login";
		}
		
//		Integer provinceId = null;  //省份ID
//		Integer cityId = null;      //城市ID
		// 获取省列表,在页面显示省份
		provinces = areaService.findAreaByParendIdAndlvType(Area.NO_PARENT,
				Area.AreaType.PROVINCE);
		if(null != beadroll){
			if(null != beadroll.getProvinceArea() && beadroll.getProvinceArea().getId().intValue() != 0){
				Area proArea = beadroll.getProvinceArea();
//				provinceId = proArea.getId();
				sf_id = proArea.getId();
			}
			if(null != beadroll.getCityArea() && beadroll.getCityArea().getId().intValue() != 0){
				Area cityArea = beadroll.getCityArea();
//				cityId = cityArea.getId();
				cs_id = cityArea.getId();
				
			}
			// 通过省份ID查询所有城市，页面获取值<*>
			cityList = areaService.findAreaByParendIdAndlvType(sf_id,Area.AreaType.CITY);
		}else{
			if(null != sf_id && null != cs_id){
				// 通过省份ID查询所有城市，页面获取值<*>
				cityList = areaService.findAreaByParendIdAndlvType(sf_id,Area.AreaType.CITY);
			}else {
				cityList = new ArrayList<Area>();
			}
			
		}
		String flagPage = ServletActionContext.getRequest().getParameter("flagPage");
		if(null == flagPage || flagPage.equals("")){ //flagPage=1，表示第一次点击进行搜索按钮时，不显示列表数据
			//查询所有的名录记录
			beadrollPage = beadrollService.findRandomAllBeadrollList(pageNo, pageSize2, sf_id, cs_id);
			this.setSessionAtrribute("bpage", beadrollPage);
		}
		if (returnFlag == 1) {
			beadrollPage = (Page<Beadroll>) this.getSessionAtrribute("bpage");
		}
		
		return "beadrollSearchList";
	}
	
	/**20120305
	 * 前台-进入名录[查看]详情 (beadrollSearch\beadrollRecordDetail.jsp)
	 * @return
	 */
	public String toLookDetailBeadroll(){
		if(null == this.getSessionAtrribute(Constants.SESSION_USER))
		{
			return "g_login";
		}
		
		try {
			String beadrollid = ServletActionContext.getRequest().getParameter("bid");
			Integer bid = Integer.valueOf(beadrollid);
			
			beadroll = beadrollService.queryBeadroll(bid);
									
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return "lookDetailBeadroll";
	}
	
}
